﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UserControls_EmpresasList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // don't reload data during postbacks
        if (!IsPostBack)
        {
            PopulateControls();
        }
    }

    private void PopulateControls()
    {
        // Retrieve CategoryID from the query string
        string categoryId = Request.QueryString["categoriaID"];

        // If browsing a category...
        if (categoryId != null)
        {
            // Retrieve list of ads in a category
            list.DataSource = CatalogAccess.GetAnunciosNaCategoria(categoryId);
            list.DataBind();
 
        }
        else
        {
            // Retrieve list of ads on catalog promotion
            list.DataSource = CatalogAccess.GetAnunciosEmFrontPromo();
            list.DataBind();
        }
    }
}
